Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify handling of Liberty file related variables #2619

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

widlarizer
Copy link
Contributor

@widlarizer widlarizer commented Dec 10, 2024

  • remove preprocessLib.py
    • yosys-abc accepts user-defined attribute original_pin used in Liberty file pin declarations of cells it actually uses to map to even if original_pin is not defined as user-defined. Probably from Synopsys PrimeTime folklore? Can't find much of a trace. Let me know if private PDKs break with this
    • yosys accepts the Liberty expression pattern described in the comment, see here
    • extract gz in Makefile instead (could be done more elegantly but I don't like fiddling with Make)
  • rename DONT_USE_LIBS->LIB_FILES_EXTRACTED
    • it's the files listing cells that should be used, but it was named the same as the list of cells that shouldn't be used. This is because before syn: move dont_use processing to yosys #1813 there was a script that would add dont_use attributes to some of the cells in those files
    • the only difference between LIB_FILES_EXTRACTED and LIB_FILES is that they're extracted if gzip and copied to objects/
  • rename DONT_USE_SC_LIB->SC_LIB_FILE

I tried this out with asap7 and nangate and it seems to work fine

cc @povik

@widlarizer
Copy link
Contributor Author

This can be followed up by integrating YosysHQ/yosys#4797 and redoing #2139 if possible

Copy link
Collaborator

@rovinski rovinski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work on this!

@@ -23,7 +23,7 @@ proc write_keep_hierarchy {} {
if {[env_var_exists_and_non_empty DFF_LIB_FILE]} {
dfflibmap -liberty $::env(DFF_LIB_FILE)
} else {
dfflibmap -liberty $::env(DONT_USE_SC_LIB)
dfflibmap -liberty $::env(SC_LIB_FILE)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only reason for this if/else is because dfflibmap used to only take one liberty file. If it accepts multiple now, then you can simply pass in LIB_FILES_EXTRACTED and eliminate the DFF_LIB_FILE variable entirely. In fact, DFF_LIB_FILE was added exclusively to support ASAP7, no other PDK uses it.

@@ -67,7 +67,7 @@ foreach cell $::env(DONT_USE_CELLS) {
if {[env_var_exists_and_non_empty DFF_LIB_FILE]} {
dfflibmap -liberty $::env(DFF_LIB_FILE) {*}$dfflibmap_args
} else {
dfflibmap -liberty $::env(DONT_USE_SC_LIB) {*}$dfflibmap_args
dfflibmap -liberty $::env(SC_LIB_FILE) {*}$dfflibmap_args
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Comment on lines +357 to +363
$(LIB_FILES_EXTRACTED): $$(filter %$$(@F) %$$(@F).gz,$(LIB_FILES))
@mkdir -p $(OBJECTS_DIR)/lib
$(UTILS_DIR)/preprocessLib.py -i $^ -o $@
@if echo "$<" | grep -q "\.gz$$"; then \
gunzip -c $< > $@; \
else \
cp $< $@; \
fi
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does Yosys support reading in compressed .gz files and decompressing on-the-fly? This step could be entirely eliminated if so.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not, but it could. It requires zlib by default to support .fst wave files. I'll see what I can do

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it does when you supply the file to a frontend (e.g. read_liberty) but not e.g. in dfflibmap -liberty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants